/**
 * @file bubbleSort.c
 * @author your name (you@domain.com)
 * @brief 模拟冒泡排序
 * @version 0.1
 * @date 2022-10-26
 * 
 * @copyright Copyright (c) 2022
 * 
 */
#include <stdio.h>
#define N 10
int main(){
    int num[N];
    int i,j;
    int tmp;
    //读入n个数
    for(i=0;i<N;i++){
        scanf("%d",&num[i]);
    }
    /*交换*/
    /*外层--->交换的趟数*/
    for(i=1;i<=N-1;i++){
        /*进行比较*/
        for(j=0;j<N-i;j++){//j<=1-i 发生越界
            if(num[j]>num[j+1]){
                /*换序num[j]-->num[j+1],num[j+1]-->num[j]*/
                tmp = num[j+1];
                num[j+1]=num[j];
                num[j]=tmp;
            }
        }
    }

    printf("The sorted number is: ");
    for(i=0;i<N;i++){
        printf("%d ",num[i]);
    }
    return 0;
}